package com.msb.apipassenger.service;

import com.msb.apipassenger.feign.ServicePriceClient;
import com.msb.commons.dto.ForecastPriceDTO;
import com.msb.commons.response.ForecastPriceResponse;
import com.msb.commons.response.ResponseResult;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @Author: chshh
 * @version: 1.0
 */
@Service
@Slf4j
public class ForecastPriceService {

    @Autowired
    private ServicePriceClient servicePriceClient;
    /**
     * 根据出发地和目的地的经纬度,计算预估价格
     * @param depLongitude
     * @param depLatitude
     * @param destLongitude
     * @param destLatitude
     * @return
     */
    public ResponseResult forecastPrice(String depLongitude, String depLatitude,
                                        String destLongitude, String destLatitude,
                                        String cityCode,String vehicleType){
        ForecastPriceDTO forecastPriceDTO = new ForecastPriceDTO();
        forecastPriceDTO.setDepLongitude(depLongitude);
        forecastPriceDTO.setDepLatitude(depLatitude);
        forecastPriceDTO.setDestLongitude(destLongitude);
        forecastPriceDTO.setDestLatitude(destLatitude);
        forecastPriceDTO.setCityCode(cityCode);
        forecastPriceDTO.setVehicleType(vehicleType);

        log.info("调用计价服务,计算价格");
        return servicePriceClient.ForecastPrice(forecastPriceDTO);
    }
}